#ifndef EZTHREAD_H
#define EZTHREAD_H

#include <QObject>
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
#include "ezthreadevent.h"
#include "EZThreadDefine.h"
#include <QList>

class EZThread : public QThread
{
    Q_OBJECT
public:
    explicit EZThread(QObject *parent = 0);

private:
    QMutex _eventsMutex;
    QWaitCondition _eventWaitCondition;
    QList<EZRunFuncEvent*> _events;
public:
    void addRunFunc(EZRunFuncEvent *event); // lock obj and on obj delete mast call cancelRunFunc
    void cancelRunFunc(EZRunFuncEvent *event);

    //todo addSigRunFunc this function run finish will send signal but no lock obj
signals:

public slots:

protected:
    virtual void run();

};

#endif // EZTHREAD_H
